﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 简单工厂模式
{
    internal class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Console.Write("请输入数字A：");
                string numberA = Console.ReadLine();
                Console.Write("请选择运算符号(+,-,*,/)：");
                string operate = Console.ReadLine();
                Console.Write("请输入数字B：");
                string numberB = Console.ReadLine();

                Operation operation = OperationFactory.CreateOperation(operate);
                operation.NumberA = int.Parse(numberA);
                operation.NumberB = int.Parse(numberB);
                Console.WriteLine("结果是：{0}", operation.GetResult());
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine("您的输入有错：{0}", ex.Message);
            }
        }
    }
}
